using System; const string PhraseFileEnvVar = "PhraseFile"; if ( ! DataSet.Project.EnvironmentVariables.Has(PhraseFileEnvVar) ) { throw new ApplicationException("Environment variable not set: " + PhraseFileEnvVar); } string filePath = DataSet.Project.EnvironmentVariables.Get(PhraseFileEnvVar); if ( string.IsNullOrEmpty(filePath) ) { throw new ApplicationException("Value for environment variable is not set: " + PhraseFileEnvVar); } if (!System.IO.File.Exists(filePath)) { throw new ApplicationException("The specified file does not exist: " + filePath); } // Read lines from file and populate dataset string[] lines = System.IO.File.ReadAllLines(filePath); int lineIndex = 1; foreach (string line in lines) { string phrase = line.Trim(); if (!string.IsNullOrEmpty(phrase)) { IDataSetRecord record = DataSet.CreateRecord(); record.AddValue("Id", lineIndex++); record.AddValue("Phrase", phrase); DataSet.AddRecord(record); } }